<template>
  <h2>
    a={{ a }}
    <button @click="a++">修改a</button>
  </h2>
  <h2>
    b={{ b }}
    <button @click="b++">修改b</button>
  </h2>
</template>

<script lang="ts">
import { ref, watch } from "vue";

export default {
  setup() {
    let a = ref(100),
      b = ref(200);

    watch([a, b], function (newValueArray, oldValueArray) {
      console.log("a,b被修改了", newValueArray, oldValueArray);
    });

    return { a, b };
  },
};
</script>
<style></style>
